package com.meituan.controller;

import com.meituan.pojo.entity.Goods;
import com.meituan.pojo.resp.BaseResp;
import com.meituan.service.GoodsService;
import com.meituan.service.ZhuYeService;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName GoodsController
 * @Description TODO
 * @Author 南山北往
 * @Date 2022/9/27 16:17
 * @Version 1.0
 **/
@RestController
@RequestMapping("goods")
public class GoodsController {
    @Autowired
    GoodsService service;

//    @RequiresPermissions(value ={"goods_findAll"})
    @PostMapping("findBySid")
    @ApiOperation("执行时间:进入店铺页面后默认执行,查询店铺所属的全部商品信息;传入参数:店铺所属id;传出参数:所有商品集合;")
    public BaseResp findBySid(Integer sid){
        return service.findBySid(sid);
    }

//    @RequiresPermissions(value ={"goods_update"})
    @PostMapping("update")
    public BaseResp update(Goods goods){
        return service.update(goods);
    }

//    @RequiresPermissions(value ={"goods_delete"})
    @PostMapping  ("delete")
    public BaseResp delete(Goods goods){
        goods.setState(0);
        return service.update(goods);
    }

}
